<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>lagou-job</title>
    <link rel="stylesheet" type="text/css" href="css/iview.css">
    <script type="text/javascript" src="js/vue.min.js"></script>
    <script type="text/javascript" src="js/iview.min.js"></script>
    <script type="text/javascript" src="js/axios.min.js"></script>
    <script type="text/javascript" src="js/common.js"></script>
</head>
<body>
<div id="app">
    <div class="layout">
        <i-layout>
            <i-header></i-header>
            <i-content style="width: 1200px;margin: 0 auto;">
                <Row style="height: 160px">
                    <i-col span="16">
                        <div>
                            <h4>{{position.companyName}}</h4>
                            <h1>{{position.pname}}</h1>
                            <h3>
                                <span style="color: #fd5f39"><span>{{position.psalaryMin}}</span>K-<span>{{position.psalaryMax}}</span>K </span> /
                                经验<span>{{position.pyearMin}}</span>-<span>{{position.pyearMax}}</span>年 /
                                <span>{{position.pedu}}</span>
                            </h3>
                            <h4 style="color: #999">{{position.ptime}}  发布于拉勾网</h4>
                        </div>
                    </i-col>
                    <i-col span="8" style="margin-top: 30px">
                        <i-button type="primary" @click="logCollect(position.pcompany, 'job_collect', userId)">收藏</i-button>
                        <i-button type="primary" @click="logCollect(position.pcompany, 'cv_send', userId)">投递简历</i-button>
                        <i-button type="primary" @click="logCollect(position.pcompany, 'cv_upload', userId)">上传简历</i-button>
                    </i-col>
                </Row>
                <Row>
                    <i-col span="18">
                        <div>
                            <h3>职位描述：</h3>
                            <div style="margin-top: 10px" v-html="position.pdescribe"></div>
                        </div>
                    </i-col>
                </Row>
            </i-content>
        </i-layout>
    </div>
</div>
<script>
    let app = new Vue({
        el: '#app',
        data: {
            pid: "",
            userId: "",
            position : {
                pname: "",
                psalaryMin: "",
                psalaryMax: "",
                pyearMin: "",
                pyearMax: "",
                pedu: "",
                ptime: "",
                pdescribe:"",
                companyName : ""
            }
        },
        mounted() {
            this.pid = window.localStorage.getItem("pid");
            this.userId = window.localStorage.getItem("userId");
            this.getPositionDetail();
        },
        methods: {
            /**
             * 获得职位详情信息
             */
            getPositionDetail() {
                let then = this;
                axios.get('/job/position/getPositionDetail/'+then.pid, {
                        params :{
                            pid : then.pid
                        }
                    })
                    .then((rep) => {
                        if(rep.data.code == 0) {
                            then.position = rep.data.data;
                        }
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
            }
        }
    });
</script>
</body>
</html>